package com.dearbinge.utils;

import java.security.MessageDigest;

/**
 *
 */
public final class MD5s {

	public static void main(String[] args) {

		System.out.println(execute("13761660481f45f9423584d420cd810e942f"));

	}

    /**
     * 32位
     * @param plainText
     * @return
     */
    public static String execute(String plainText) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(plainText.getBytes("UTF-8"));
            byte b[] = md.digest();
            int i;
            StringBuilder buf = new StringBuilder("");
            for (int offset = 0; offset < b.length; offset++) {
                i = b[offset];
                if (i < 0) {
                    i += 256;
                }
                if (i < 16) {
                    buf.append("0");
                }
                buf.append(Integer.toHexString(i));
            }

            return buf.toString();

        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }

}
